import torchvision
import torch
from torchvision.models import VGG16_Weights

vgg16_false = torchvision.models.vgg16()
# 之前的pretrained属性已经启用，会去下载预训练的模型数据
vgg16_true = torchvision.models.vgg16(weights=VGG16_Weights.IMAGENET1K_FEATURES)

# 给模型添加操作
vgg16_false.add_module("add_linear", torch.nn.Linear(1000, 10))
# 给classifier中添加操作
vgg16_false.classifier.add_module("7", torch.nn.Linear(1000, 10))
# 修改classifier中的操作
vgg16_false.classifier[6] = torch.nn.Linear(4096, 10)
print(vgg16_false)